﻿using UnityEngine;

/**
 * 战斗业务
 */
public class BattleSys : SystemRoot{
    
    public static BattleSys Instance;

    public PlayerCtrlWnd playerCtrlWnd;

    private BattleMgr battleMgr;
    
    public override void InitSys(){
        base.InitSys();
        Instance = this;
        PECommon.Log("Init BattleSys");
    }

    public void StartBattle(int mapid){
        GameObject go = new GameObject{
            name = "BattleRoot"
        };
        go.transform.SetParent(GameRoot.Instance.transform);

        battleMgr = go.AddComponent<BattleMgr>();
        battleMgr.Init(mapid);
    }

    public void SetPlayerCtlWndState(bool isActive = true){
        playerCtrlWnd.SetWndState(isActive);
    }
    
    public void SetSelfPlayerMoveDir(Vector2 dir){
        battleMgr.SetSelfPlayerMoveDir(dir);
    }

    public void ReqReleaseSkill(int index){
        battleMgr.ReqReleaseSkill(index);
    }
    
    public Vector2 GetDirInput(){
        return playerCtrlWnd.currentDir;
    }
}